package com.ityedao.递归;

public class SumTest {
    public static void main(String[] args) {
        System.out.println(sum(5));
    }

    private static int sum(int n) {
        if (n == 1){
            return 1;
        }else {
            return n + sum(n-1);
        }
    }
}
